<template>
    <div>
        <van-field label='用户名' v-model="form.username"/>
        <van-field label='密码' v-model="form.password"/>
        <van-button @click="add">登录</van-button>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                form:{}
            }
        },
        methods:{
            add(){
                this.$axios.post('auser/login',this.form).then(res=>{
                    if(res.data.code==200){
                        localStorage.setItem('userid',res.data.userid)
                        localStorage.setItem('username',res.data.username)
                        this.$router.push('uinfo')
                    }
                })
            }
        }
    }
</script>

<style scoped>

</style>